<?php
// 本类由系统自动生成，仅供测试用途
class IndexAction extends Action {
    public function index(){

    	// 查询首页今日金句
    	$Golden = M("Golden"); // 实例化User对象
    	// 获取ID为3的用户的昵称
    	$td_golden = $Golden->order('golden_id desc')->find();
    	$this->assign('td_golden', $td_golden);
    	
    	// 查询首页牧师证道
    	$Article = M("Article");
    	$condition['article_type_name'] = sermon;
    	$Sermon=$Article->where($condition)->order('article_id desc')->find();
    	$this->assign('Sermon',$Sermon);
    	
    	// 查询首页见证分享
    	$Article = M("Article");
    	$condition['article_type_name'] = witness;
    	$Witness=$Article->where($condition)->limit(5)->order('article_id desc')->select();
    	$this->assign('Witness',$Witness);
    	
    	// 查询首页信仰需知
    	$Article = M("Article");
    	$condition['article_type_name'] = faith;
    	$Faith=$Article->where($condition)->limit(5)->order('article_id desc')->select();
    	$this->assign('Faith',$Faith);
    	
    	// 查询首页关于我们简介
    	/*
		$single_page = M("single_page");
    	$condition['single_page_title'] = about_us;
    	$AboutUs=$single_page->where($condition)->order('single_page_id desc')->find();
    	$this->assign('AboutUs',$AboutUs);
    	*/
    	
    	// 查询首页关于我们简介
    	$single_page = M("single_page"); 
    	$td_single_page = $single_page->order('single_page_id desc')->find();
    	$this->assign('td_single_page', $td_single_page);
    	

    	$pray = M("pray");
    	// 普通的列表查询
    	$list = $pray->limit(2)->order('pray_id desc')->find();
    	$this->assign('list', $list);

    	// 查询首页公告
    	$notice=M("notice");
    	$list2 = $notice->limit(3)->order('notice_id desc')->select();
    	$this->assign("list2",$list2);
    	
    	// 查询首页新闻
    	$Article = M("Article");
    	$condition['article_type_name'] = news;
    	$News=$Article->where($condition)->limit(5)->order('article_id desc')->select();
    	$this->assign('News',$News);
    	
    	// 查询首页祷告
    	$Pray = M("Pray");
    	$td_pray=$Pray->limit(3)->order('pray_id desc')->select();
    	$this->assign('td_pray',$td_pray);
    	
    	// 查询首页关于联系我们
    	$single_page = M("single_page"); 
    	$ContactUs = $single_page->order('single_page_id asc')->find();
    	$this->assign('ContactUs', $ContactUs);

		$this ->display();	
    	
    }
    
     public function detial(){
    
    	$a_id = $_GET["_URL_"][3];
    	$Article = M("Article");
    	$condition['article_id'] = $a_id;
    	$NewsD=$Article->where($condition)->find();
    	$this->assign('NewsD',$NewsD);
    	
    	$a_id = $_GET["_URL_"][2];
    	$Article = M("Article");
    	$condition['article_id'] = $a_id;
    	$SermonD=$Article->where($condition)->find();
    	$this->assign('SermonD',$SermonD);
    	
    	$a_id = $_GET["_URL_"][3];
    	$Article = M("Article");
    	$condition['article_id'] = $a_id;
    	$FaithD=$Article->where($condition)->find();
    	$this->assign('FaithD',$FaithD);
    	
    	$a_id = $_GET["_URL_"][3];
    	$Article = M("Article");
    	$condition['article_id'] = $a_id;
    	$WitnessD=$Article->where($condition)->find();
    	$this->assign('WitnessD',$WitnessD);
    
    	$this->display();
    }
}



?>